package com.ahoi.service;

import com.ahoi.common.utils.DateUtils;
import com.ahoi.dao.ErrorUrlDao;
import com.ahoi.model.ErrorUrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: ahoi
 * @Date: 2018/4/28 17:19
 * @Description: 失败请求url
 */
@Service
public class ErrorUrlService {

    @Autowired
    private ErrorUrlDao errorUrlDao;


    /**
     * 查询所有
     */
    public List<ErrorUrl> listAll() {
        return errorUrlDao.listAll();
    }

    /**
     * 删除所有
     */
    public void deleteAll() {
        errorUrlDao.deleteAll();
    }

    /**
     * 插入
     */
    public void insertOne(String url) {
        ErrorUrl model = new ErrorUrl();
        model.setUrl(url);
        model.setTime(DateUtils.getTimeStamp());
        errorUrlDao.insertOne(model);
    }

}
